package asava.tools;

/**
 * @author Tim Richter
 */
public final class Tokens {
    public static final int PUBLIC = 1;
    public static final int PRIVATE = 2;
    public static final int PROTECTED = 3;
    public static final int INTERNAL = 4;
    public static final int DYNAMIC = 5;
    public static final int FINAL = 6;
    public static final int NATIVE = 7;
    public static final int STATIC = 8;
    public static final int OVERRIDE = 9;

    public static final int PACKAGE = 20;
    public static final int CLASS = 21;
    public static final int INTERFACE = 22;
    public static final int FUNCTION = 23;
    public static final int GET = 24;
    public static final int SET = 25;
    public static final int VAR = 26;
    public static final int CONST = 27;

    public static final int EXTENDS = 30;
    public static final int IMPLEMENTS = 31;
    public static final int NAMESPACE = 32;
    public static final int IMPORT = 33;
    public static final int USE = 34;

    public static final int BREAK = 40;
    public static final int CASE = 41;
    public static final int CONTINUE = 42;
    public static final int DEFAULT = 43;
    public static final int DO = 44;
    public static final int ELSE = 45;
    public static final int FOR = 46;
    public static final int IN = 47;
    public static final int EACH = 48;
    public static final int IF = 49;
    public static final int RETURN = 50;
    public static final int SUPER = 51;
    public static final int SWITCH = 52;
    public static final int THROW = 53;
    public static final int TRY = 54;
    public static final int CATCH = 55;
    public static final int FINALLY = 56;
    public static final int WHILE = 57;
    public static final int WITH = 58;
    public static final int DELETE = 59;
    public static final int FALSE = 60;
    public static final int NULL = 61;
    public static final int THIS = 62;
    public static final int TRUE = 63;
    public static final int STRING = 64; // string literal
    public static final int INT = 65; // public static final int literal
    public static final int NUMBER = 66; // number literal
    public static final int IDENT = 67; // identifier (f.i. class or variable name)
    public static final int INSTANCEOF = 68;
    public static final int AS = 69;
    public static final int IS = 70;
    public static final int NEW = 71;

    public static final int COMMA = 80;
    public static final int SEMI = 81;
    public static final int COLON = 82;
    public static final int COLONCOLON = 83;
    public static final int DOT = 84;
    public static final int DOTDOTDOT = 85;
    public static final int QUES = 86; // '?'
    public static final int LPAREN = 87; // '('
    public static final int RPAREN = 88; // ')'
    public static final int LBRACK = 89; // '['
    public static final int RBRACK = 90; // ']'
    public static final int LBRACE = 91; // '{'
    public static final int RBRACE = 92; // '}'

    public static final int PLUS = 100; // '+'
    public static final int PLUSPLUS = 101; // '++'
    public static final int PLUSEQ = 102; // '+='
    public static final int MIN = 103; // '-'
    public static final int MINMIN = 104; // '--'
    public static final int MINEQ = 105; // '-='
    public static final int STAR = 106; // '*'
    public static final int STAREQ = 107; // '*='
    public static final int SLASH = 108; // '/'
    public static final int SLASHEQ = 109; // '/='
    public static final int PERC = 110; // '%'
    public static final int PERCEQ = 111; // '%='
    public static final int LT = 112; // '<'
    public static final int LTEQ = 113; // '<='
    public static final int LTLT = 114; // '<<'
    public static final int LTLTEQ = 115; // '<<='
    public static final int GT = 116; // '>'
    public static final int GTEQ = 117; // '>='
    public static final int GTGT = 118; // '>>'
    public static final int GTGTEQ = 119; // '>>='
    public static final int GTGTGT = 120; // '>>>'
    public static final int GTGTGTEQ = 121; // '>>>='
    public static final int BAR = 122; // '|'
    public static final int BAREQ = 123; // '|='
    public static final int BARBAR = 124; // '||'
    public static final int AMP = 125; // '&'
    public static final int AMPEQ = 126; // '&='
    public static final int AMPAMP = 127; // '&&'
    public static final int CARET = 128; // '^'
    public static final int CARETEQ = 129; // '^='
    public static final int TILDE = 130; // '~'
    public static final int EQ = 131; // '='
    public static final int EQEQ = 132; // '=='
    public static final int EQEQEQ = 133; // '==='
    public static final int NOT = 134; // '!'
    public static final int NOTEQ = 135; // '!='
    public static final int NOTEQEQ = 136; // '!=='

    public static final int EOF = 200; // end of file

    public static String toString(final int token) {
        switch (token) {
            case PUBLIC:
                return "public";
            case PRIVATE:
                return "private";
            case PROTECTED:
                return "protected";
            case INTERNAL:
                return "internal";
            case DYNAMIC:
                return "dynamic";
            case FINAL:
                return "final";
            case NATIVE:
                return "native";
            case STATIC:
                return "static";
            case OVERRIDE:
                return "override";
            case PACKAGE:
                return "package";
            case CLASS:
                return "class";
            case INTERFACE:
                return "interface";
            case FUNCTION:
                return "function";
            case GET:
                return "get";
            case SET:
                return "set";
            case VAR:
                return "var";
            case CONST:
                return "const";
            case EXTENDS:
                return "extends";
            case IMPLEMENTS:
                return "implements";
            case NAMESPACE:
                return "namespace";
            case USE:
                return "use";
            case BREAK:
                return "break";
            case CASE:
                return "case";
            case CONTINUE:
                return "continue";
            case DEFAULT:
                return "default";
            case DO:
                return "do";
            case ELSE:
                return "else";
            case FOR:
                return "for";
            case IN:
                return "in";
            case EACH:
                return "each";
            case IF:
                return "if";
            case RETURN:
                return "return";
            case SUPER:
                return "super";
            case SWITCH:
                return "switch";
            case THROW:
                return "throw";
            case TRY:
                return "try";
            case CATCH:
                return "catch";
            case FINALLY:
                return "finally";
            case WHILE:
                return "while";
            case WITH:
                return "with";
            case DELETE:
                return "delete";
            case FALSE:
                return "false";
            case NULL:
                return "null";
            case THIS:
                return "this";
            case TRUE:
                return "true";
            case STRING:
                return "string literal";
            case INT:
                return "int literal";
            case NUMBER:
                return "number literal";
            case IDENT:
                return "identifier";
            case INSTANCEOF:
                return "instanceof";
            case AS:
                return "as";
            case IS:
                return "is";
            case NEW:
                return "new";
            case COMMA:
                return ",";
            case SEMI:
                return ";";
            case COLON:
                return ":";
            case COLONCOLON:
                return "::";
            case DOT:
                return ".";
            case QUES:
                return "?";
            case LPAREN:
                return "(";
            case RPAREN:
                return ")";
            case LBRACK:
                return "[";
            case RBRACK:
                return "]";
            case LBRACE:
                return "{";
            case RBRACE:
                return "}";
            case PLUS:
                return "+";
            case PLUSPLUS:
                return "++";
            case PLUSEQ:
                return "+=";
            case MIN:
                return "-";
            case MINMIN:
                return "--";
            case MINEQ:
                return "-=";
            case STAR:
                return "*";
            case STAREQ:
                return "*=";
            case SLASH:
                return "/";
            case SLASHEQ:
                return "/=";
            case PERC:
                return "%";
            case PERCEQ:
                return "%=";
            case LT:
                return "<";
            case LTEQ:
                return "<=";
            case LTLT:
                return "<<";
            case LTLTEQ:
                return "<<=";
            case GT:
                return ">";
            case GTEQ:
                return ">=";
            case GTGT:
                return ">>";
            case GTGTEQ:
                return ">>=";
            case GTGTGT:
                return ">>>";
            case GTGTGTEQ:
                return ">>>=";
            case BAR:
                return "|";
            case BAREQ:
                return "|=";
            case BARBAR:
                return "||";
            case AMP:
                return "&";
            case AMPEQ:
                return "&=";
            case AMPAMP:
                return "&&";
            case CARET:
                return "^";
            case CARETEQ:
                return "^=";
            case TILDE:
                return "~";
            case EQ:
                return "=";
            case EQEQ:
                return "==";
            case EQEQEQ:
                return "===";
            case NOT:
                return "!";
            case NOTEQ:
                return "!=";
            case NOTEQEQ:
                return "!==";
            case EOF:
                return "end of file";
            default:
                throw new IllegalArgumentException("illegal token: " + token);
        }
    }
}
